package summer_vacation.lvchang.myyVacation;
import java.util.Scanner;
/**
 * Created by Administrator on 2015/9/6.
 */
public class Text4 {
    public static void main(String[] args) {
        int i;
        int j;
        int a;
        Scanner s = new Scanner(System.in);
        System.out.println("请输入一个数：");
        i = s.nextInt();
        System.out.println("再输入一个数：");
        j = s.nextInt();
        a = zxgbs(i,j);//a是最小公倍数
        int b = i * j / a;
        System.out.println("最大公约数为：" + a);
        System.out.println("最小公倍数为：" + b);
    }

    public static int zxgbs(int x, int y) {
        int t;//t为最大公约数
        if (x < y) {
            t = y % x;//最大公约数就为y除以x的余数
        } else if (x == y) {
            t = x;//最大公约数是x
        } else {
            t = x % y;
        }
        return t;
    }
}



